home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / sbprolog / amiga / v3_1 / sbp3_1e.lzh / WRITELN.PL < prev    next >
Text File  |  1991-10-31  |  531b  |  18 lines

  1. /* From the book PROLOG PROGRAMMING IN DEPTH
  2.    by Michael A. Covington, Donald Nute, and Andre Vellino.
  3.    Copyright 1988 Scott, Foresman & Co.
  4.    Non-commercial distribution of this file is permitted. */
  5.  
  6. /* WRITELN.PL */
  7.  
  8. /* If the argument is a list, display the elements      */
  9. /* one by one and start a new line after each.          */
  10. /* Otherwise display the argument and start a new line. */
  11.  
  12. writeln([]) :- !.
  13.  
  14. writeln([Head|Tail]) :- !, write(Head),nl,writeln(Tail).
  15.  
  16. writeln(Arg) :- write(Arg),nl.
  17. 
  18.